class Solution
{
public:
    bool divideArray(vector<int> &nums)
    {
        sort(nums.begin(), nums.end());
        int n = nums.size() / 2;
        for (int i = 0; i < n; ++i)
        {
            if (nums[2 * i] != nums[2 * i + 1])
            {
                return false;
            }
        }
        return true;
    }
};